package com.byb.server.service.util;

import com.byb.server.domain.Product;
import com.byb.server.service.dto.Product_sort;

import java.util.List;

/**
 * 策略模式中的上下文传递类
 */
public class RankProduct {

    private SortStrategy sortStrategy;

    public RankProduct(SortStrategy sortStrategy) {
        this.sortStrategy = sortStrategy;
    }

    public static RankProduct getContext(SortStrategy sortStrategy){
        return new RankProduct(sortStrategy);
    }

    public List<Product_sort> ranking(List<Product_sort> list, List<Product> products,List<Product> data, Integer payment){
        return this.sortStrategy.sortBy(list, products,data, payment);
    }
}
